package com.storm.container.splitter
{
	import com.storm.container.BaseContainer;
	import com.storm.container.IBaseItem;
	
	import mx.events.ResizeEvent;
	
	public class SplitterContainer extends BaseContainer {
		public function SplitterContainer() {
			super();
			
			this.itemSelectEnabled = false;
			this.addEventListener(ResizeEvent.RESIZE, resizeHandler);
		}
		
		private function resizeHandler(event:ResizeEvent):void {
			this.foreachItem(function(item:IBaseItem):void {
				item.width = this.width;
				item.height = this.height;
			});
		}
		
		public static const DIRECTION_HORIZONTAL:String = "horizontal";
		public static const DIRECTION_VERTICAL:String = "vertical";
		
		private var _direction:String = DIRECTION_HORIZONTAL;
		public function get direction():String {
			return this._direction;
		}
		public function set direction(value:String):void {
			if (this._direction == value) return;
			this._direction = value;
			this.layoutItems();
		}
		
		override protected function initializeItem(item:IBaseItem):void {
			super.initializeItem(item);
			item.width = this.width;
			item.height = this.height;
		}
	}
}